*** Create Table 2, expanded cohort ***

********************************************************************************

clear 

** read in .dta file **

use "${clean}/who_counts_analysis.dta", clear

** Table 3 focuses on 17 year cohort ** 


** Main specification, 1945-1962 **

xi: reghdfe MOB did_ANY Arabic Female *_itTREATED *_itANYFOR, a(geo2_ma reg_fe YOB) cluster(geo2_ma)
estadd local controls = "$\surd$",replace
estadd local adminFE = "$\surd$", replace 
estadd ysumm, replace
eststo m_MOB_did_BW2_any

xi: reghdfe Schooling did_edu_ANY Arabic Female *_itTREATEDEDU *_itANYFOR, a(geo2_ma reg_fe YOB) cluster(geo2_ma)
estadd local controls = "$\surd$",replace
estadd local adminFE = "$\surd$", replace 
estadd ysumm, replace
eststo m_School_did_BW2_any

xi: reghdfe French_Lit did_edu_ANY Arabic Female *_itTREATEDEDU *_itANYFOR, a(geo2_ma reg_fe YOB) cluster(geo2_ma)
estadd local controls = "$\surd$",replace
estadd local adminFE = "$\surd$", replace 
estadd ysumm, replace
eststo m_LIT_did_BW2_any

xi: reghdfe EDU_YRS did_edu_ANY Arabic Female *_itTREATEDEDU *_itANYFOR, a(geo2_ma reg_fe YOB) cluster(geo2_ma)
estadd local controls = "$\surd$",replace
estadd local adminFE = "$\surd$", replace 
estadd ysumm, replace
eststo m_YRS_did_BW2_any

#delimit ; 
estout m_MOB_did_BW2_any
	   m_School_did_BW2_any
	   m_LIT_did_BW2_any
	   m_YRS_did_BW2_any
       using "${output}/tables/Table3.tex",
       style(tex) 
       cells(b(star fmt(3)) se(par fmt(3))) 
	   	   varlabels(did_ANY "Difference in Differences, registration" did_edu_ANY "Difference in Differences, education"  Female "Female " Arabic "First Language Arabic ")
keep(did_ANY did_edu_ANY)
	   stats(controls
	   adminFE
             r2 
             N
			 ymean, fmt(0 0 2 0 3 %9.0gc %9.0gc)
             labels("\hline Controls"
			 "\hline Admin FE"
                   "\hline \(R^2\)" 
                  " \hline N"
				   "Dep. Var. Mean "))
       mlabels(,none) 
       numbers
       collabels(none) 
       starl(* 0.1 ** 0.05 *** 0.01)
	          prehead( 
           \begin{table}[H]
           \caption{Effect of Reforms and European Settlement on Registration and Education Outcomes, 1945-1962}        
           \label{tab:DiD_BW2}            
           \centering
           \begin{tabular}{@{\extracolsep{4pt}}l*{@M}{c}@{}} 
           \hline \hline             
		   & \multicolumn{1}{p{3cm}}{\centering Registration} 
		   & \multicolumn{1}{p{3cm}}{\centering Formal Schooling}   
		   & \multicolumn{1}{p{3cm}}{\centering Literacy, Arabic \& French} 
		   & \multicolumn{1}{p{3cm}}{\centering Formal Schooling, Years}                    \\  
       )
       posthead(\hline) 
       prefoot() 
       postfoot(
           \noalign{\smallskip} \hline \hline 
           \end{tabular}
           \medskip
           \begin{minipage}{.9\textwidth}
           \tiny \justify Notes: \( @starlegend \). 
           \\ Fixed Effects and Clustered Robust Standard Errors at Province.
           \end{minipage}        
       \end{table}
       )
       replace;
#delimit cr
